<template>
  <div class="article">
    <h1>标题：{{ this.article.title }}</h1>
    <div>{{ this.article.content }}</div>
  </div>
</template>
<script>
import { getPost } from "../api/list";
export default {
  name: "article",
  data() {
    return {
      article: {
        title: "",
        content: "",
      }
    };
  },
  created() {
      this.getArticle()
  },
  methods: {
    getArticle() {
        getPost()
          .then(res => {
            if (res.data.code === 200) {
                this.article = res.data.data;
            } else {
              this.$message.error(res.data.message);
            }
          })
          .catch(err => {
            console.log(err);

            //alert(err)
          });
      }
    }
  }
};
</script>
